package da25_start.练习;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class 点名 {
    public static void main(String[] args) {
        //要求，在点名的时候不能重复，并且点名完一轮后重新开始
        Random r = new Random();
        //1.定义集合
        ArrayList<String> list1 = new ArrayList<>();
        ArrayList<String> list2 = new ArrayList<>();
        //2.添加数据
        //"范统","杜子腾","杜琦燕","宋合泛","侯笼","朱益群","朱穆玛峰"
        Collections.addAll(list1,"范县","饭桶","犯贱","杜子腾","杜琦燕","宋合泛","侯笼","朱益群","朱穆玛峰");
        Collections.shuffle(list1);
        //i表示第几轮
        for (int i = 0; i < 2; i++) {
            System.out.println("==================第"+(i + 1)+"轮点名===================");
            int size = list1.size();
            for (int j = 0; j < size; j++) {
                int index = r.nextInt(list1.size());
                String name = list1.remove(index);
                System.out.println(name);
                list2.add(name);
            }
            list1.addAll(list2);
            list2.clear();
        }
    }
}
